feat(generator): build full SDK generation foundation - #7
Draft
nmorgan-cb wants to merge 14 commits into
Draft
nmorgan-cb wants to merge 14 commits into
nmorgan-cb wants to merge 14 commits into
Conversation
🟡 Heimdall Review Status
|
nmorgan-cb
force-pushed
the
toshi/plan-service-generator-upgrade
branch
from
September 2, 2026 17:43
d0671ee to
5e2693d
Compare
This was referenced Sep 2, 2026
Co-authored-by: Toshi <toshi-noreply@coinbase.com>
Co-authored-by: Toshi <toshi-noreply@coinbase.com>
Co-authored-by: Toshi <toshi-noreply@coinbase.com>
Co-authored-by: Toshi <toshi-noreply@coinbase.com>
Co-authored-by: Toshi <toshi-noreply@coinbase.com>
Co-authored-by: Toshi <toshi-noreply@coinbase.com>
Co-authored-by: Toshi <toshi-noreply@coinbase.com>
Co-authored-by: Toshi <toshi-noreply@coinbase.com>
Java converges on canonical cross-SDK method/type names while every previously public Java name is preserved as a source-compatible, generated deprecated alias, declared entirely from config: - add `deprecatedAliases` to GeneratorConfiguration.Override, parsed from tools/model-generator/config/operations-overrides.json - add DeprecatedAlias and OperationBinding.deprecatedAliases() - OperationBindingValidator rejects an alias that matches its own canonical name or collides with another Java service method - RequestPhase emits deprecated alias request classes as subclasses of the canonical request, with a covariant Builder subclass (including pagination builder methods and convenience constructors) so `new LegacyRequest.Builder()...build()` keeps compiling and returning the legacy type; the canonical builder's validate() is now protected so the alias build() can invoke it - ResponsePhase emits deprecated alias response subclasses - ServicePhase emits `@Deprecated` forwarding methods on both the service interface and implementation, with Javadoc pointing at the canonical method Apply this to the 11 canonical/alias pairs agreed across the Java, .NET, TypeScript, Python, and Go Prime SDKs: createTransfer, createWithdrawal, getOrder, claimStakingRewards, createPortfolioStake, createPortfolioUnstake, listEntityPaymentMethods, getEntityPaymentMethod, listActivities, getAddressBook, and getAllocationsByClientNettingId, keeping their existing Java names generated as deprecated aliases. Removes the hardcoded METHOD_RENAMES entries superseded by these declarative overrides. Add config/naming-parity.json plus NamingParityTest as a versioned, in-repo fixture asserting the operation ID -> canonical Java method/type -> legacy alias -> service folder mapping for both the 11 renamed operations and 3 operations whose existing Java name is intentionally kept canonical (listEntityUsers, getEntityFcmBalance, getPortfolioCounterpartyId). This does not clone or depend on the other SDK repositories; it only locks the Java generator's own naming decisions. Add DeprecatedAliasGenerationTest covering config parsing, binding validation, and the generated request/response/service alias shape against a synthetic fixture. Verified with an isolated `git worktree add --detach` generation preview (not committed): `make generate` + `mvn test` produce a compiling, fully passing (285 tests) SDK where every legacy Java name still compiles, still returns the same public type, and now carries a deprecation warning pointing at its canonical replacement. Co-authored-by: Toshi <toshi-noreply@coinbase.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a deterministic, OpenAPI-driven generator for the full Prime Java client surface (models, requests, responses, services,
PrimeServiceFactory), and converges Java method/type names on the canonical names shared with the .NET, TypeScript, Python, and Go Prime SDKs — generating a@Deprecatedcompatibility alias for every existing public Java name that changes.This PR adds the generator, its config, and tests. It does not include regenerated SDK source; see Generation preview below.
Generator
apiSpec/prime-public-spec.yaml) drives normal generation and CI; live fetch/diff is explicit and non-mutating./v1//v2routing,PrimeXM*naming, and existing model transforms.*ErrorCode/*Subcodeenums intocom.coinbase.prime.model.errors.make fetch-spec,make generate,make check-generated,make generate-live-diff— check/live-diff render only in isolated temp dirs, never mutate the checkout.Canonical naming + generated deprecated aliases
Every alias is declared in
operations-overrides.json, never hand-written:{ "operationId": "PrimeRESTAPI_CreateWalletTransfer", "sdkMethod": "CreateTransfer", "deprecatedAliases": [{ "sdkMethod": "CreateWalletTransfer", "message": "Use createTransfer instead." }] }For each entry, the generator emits a
@Deprecatedrequest subclass (with a covariantBuildersubclass, sonew LegacyRequest.Builder()...build()still compiles and returns the legacy type), a@Deprecatedresponse subclass, and@Deprecatedforwarding methods on the service interface and implementation.createTransfercreateWalletTransfercreateWithdrawalcreateWalletWithdrawalgetOrdergetOrderByOrderIdclaimStakingRewardsclaimRewardscreatePortfolioStakeportfolioStakingInitiatecreatePortfolioUnstakeportfolioStakingUnstakelistEntityPaymentMethodslistPaymentMethodsgetEntityPaymentMethodgetPaymentMethodDetailslistActivitieslistPortfolioActivitiesgetAddressBooklistAddressBookgetAllocationsByClientNettingIdlistAllocationsByNettingIdlistEntityUsers,getEntityFcmBalance, andgetPortfolioCounterpartyIdstay canonical as-is.config/naming-parity.jsonplusNamingParityTestlock this mapping in-repo, without cloning other SDK repositories in CI.Tests
DeprecatedAliasGenerationTestandNamingParityTest.Generation preview
Ran
make generatein an isolatedgit worktree, then compiled and tested the generated SDK (285 tests passing), including existing example programs, which compile with deprecation warnings on legacy calls.make check-generatedreports new canonical types as additions and legacy names as converted alias files. The preview caught a real bug: aliasBuilder.build()initially skipped the canonical (private)validate(); it's nowprotectedand called viasuper.validate().The generated SDK baseline itself (models, DTOs, services, factory, error enums, manifest) will be committed in a follow-up, after a public API diff review, then
make check-generatedbecomes a required CI gate.Generated with Toshi
Type of Change
Checklist